
from ast import List
from fastapi import APIRouter, Depends, HTTPException, Path
from api.deps import SessionDep
from services import order_processed_service
from schemas.response_schema import R
from schemas.page_schema import PageRequestParams,PageResponse
from schemas.order_processed_schema import OrderProcessedPublic
router = APIRouter()

@router.get("/{order_processed_id}",
            response_model=R[OrderProcessedPublic],
            summary="根据id查询已处理订单详情")
async def get_order_processed_by_id(*, session: SessionDep,
                 order_processed_id: int = Path(example=1)) -> R:
    """根源id查询已处理订单详情"""
    return await order_processed_service\
        .find_order_processed_by_id(session=session, id=order_processed_id)

@router.get("/",
            # response_model=PageResponse[OrderProcessedPublic],
            summary="分页查询已处理订单")
async def get_order_processed_by_page(*, session: SessionDep,
                page:PageRequestParams = Depends()):
    db_order_processed= await order_processed_service.find_order_processed_by_page(session=session, page=page)
    return db_order_processed